package com.lq.createPattern.prototype;

public class Client {
    public static void main(String[] args) {
        System.out.println("原型设计模式下");
        Sheep sheep=new Sheep("tom",1,"白色");
        //当属性是对象时候 clone会怎么处理 会将对象引用也同时克隆 这种情况就是浅拷贝
        sheep.friend=new Sheep("javk",1,"black");

        Sheep sheep2=(Sheep)sheep.clone();
        Sheep sheep3=(Sheep)sheep.clone();
        Sheep sheep4=(Sheep)sheep.clone();
        Sheep sheep5=(Sheep)sheep.clone();
        System.out.println("sheep ="+sheep+sheep.hashCode()+sheep.getClass());
        System.out.println("sheep2 ="+sheep2+sheep2.hashCode()+sheep2.getClass());
        System.out.println("sheep3 ="+sheep3+sheep3.hashCode()+sheep3.getClass());
        System.out.println("sheep4 ="+sheep4+sheep4.hashCode()+sheep4.getClass());
        System.out.println("sheep5 ="+sheep5+sheep5.hashCode()+sheep5.getClass());
    }
}
